using System;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.ConstrainedExecution;
using UnityEngine;
using UnityEngine.EventSystems;

public class GameManager : MonoBehaviour
{
    public static GameManager Instance {get; private set;}

    private static int day = 0; // 当前日期
    [SerializeField] private float dayTime = 3.0f; // 每天的时间数（秒）
    [SerializeField] private float time = 0f;


    /*public class DayEventArgs : EventArgs
    {
        public int currentDay;
        public DayEventArgs(int currentDay)
        {
            this.currentDay = currentDay;
        }
    }*/
    public event EventHandler<int> AddDayEvent;

    private void Awake()
    {
        Instance = this;
    }

    // Start is called before the first frame update
    void Start()
    {

    }

    // Update is called once per frame
    void Update()
    {
        time += Time.deltaTime;
        if (time >= dayTime)
        {
            time = 0f;
            day++;
            Debug.Log("当前天数：" + day);
            AddDayEvent?.Invoke(this, day);
        }
    }
}
